import type { VNode } from "vue"

export type interMessageType = 'text' | 'img' | 'delete'

export type groupType = 'C2C'

export interface interGroup {
    type: interMessageType
    formatter?: (msg: string) => VNode | string | undefined
    p_formatter?: (msg: string) => VNode | string | undefined
}

export interface interGroupMenu {
    formatter: () => VNode
    p_formatter: () => VNode
}

export interface interGroupMessage {
    formatter: (msg: string) => Promise<VNode | string> | VNode | string
    p_formatter: (msg: string) => Promise<VNode | string> | VNode | string
}

export interface interGroupControl {
    show: (item: interGroupMessageInfo) => boolean
    formatter: (item: interGroupMessageInfo, index: number) => VNode
}

export interface interGroupList {
    formatter: (msg: string) => Promise<VNode | string> | VNode | string
    p_formatter?: (msg: string) => Promise<VNode | string> | VNode | string
}

export interface interGroupMessageInfo {
    id: number, isSelf: boolean,
    type: interMessageType, User: UserInfo,
    fullUrl: string, UserId: number
    msg: string, create: string, show?: boolean
}
export interface interGroupMessageInfoChange {
    message: interGroupMessageInfo,
    type: 'add' | 'back'
}
export interface interGroupInfo {
    id: number
    type: groupType, groupName: string, readed: boolean,
    LastMessage: interGroupMessageInfo
}
export interface UserInfo {
    nickname: string, fullUrl: string
}